Repository navigation
fix(aggregator): validate DeepSeek ¥-line date, fall back when impossible (#3379) - #4418
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3379.
Problem
recordsFromDeepseekBalancetook the first date-shaped string on the ¥ line unchecked. An impossible date (e.g. 2026-02-30, 2026-13-01) matched the regex and shadowed the section's validLast checkeddate, so the derived record used a nonexistent ts, failedisSnapshotRecord, and was silently dropped bySnapshotStore.append(counted asalready presentby the backfill).Change
pm-stack/aggregator/src/snapshot-records.ts: the on-line candidate is validated withparseIsoDate(mirroringfreshestDateaggregator(snapshot-records): shape-only dates win freshestDate — a 2026-13-01 'Last checked' silently drops a pool's snapshot history, 2026-02-30 is stored as a phantom March date #2264); an impossible on-line date behaves like no on-line date and falls back tolastCheckedDate(section) ?? freshestDate(section); no valid date anywhere still yields no record.pm-stack/aggregator/test/snapshot-writers.test.ts: new cases for impossible day (2026-02-30) and impossible month (2026-13-01) using the fallback and passingisSnapshotRecord, plus an impossible-on-line-date with no other valid date yielding no record.Scope
recordsFromDeepseekBalancedate derivation and its tests. No change torecordsFromProviderUsage(aggregator(snapshot-records): recordsFromProviderUsage never range-checks used_percent — a Codex window at -20% or 1e9% is appended as measured pct history against its own limit:100 #2568), github-billing date handling (aggregator(github-billing): billing items never validated — an impossible date discards the whole month's collection, negative amounts are stored as usage #2493), or SnapshotStore append/reporting semantics.Verification
cd pm-stack/aggregator && bun test test/snapshot-writers.test.ts— 23 pass, 0 fail (67 assertions), including all existing DeepSeek tests and the three new aggregator(snapshot-records): recordsFromDeepseekBalance takes the ¥ line's first date-shaped string unchecked — an impossible date (2026-02-30) shadows the section's valid Last-checked date, the record fails isSnapshotRecord and is silently dropped as 'already present' #3379 cases.Need help on this PR? Tag
@codesmith-botwith what you need.